{include file="public/header" /}
<body>
<div class="x-body">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">明细编号</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" title="无法编辑" value="{$detailArray.drawing_detail_id}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">公司编号</label>
            <div class="layui-input-inline">
                <input type="text" id="drawing_external_id" name="drawing_external_id" lay-verify="required" autocomplete="off" class="layui-input" value="">
            </div>
            <button type="button" class="layui-btn" id="createP">P</button>
            <button type="button" class="layui-btn" id="createM">M</button>
            <script>
                $(function () {

                    $("#createP").on("click",function () {
                        //获取P的值
                        $.ajax({
                            type:"post", //请求方式
                            url:"{:url('index/Blueprint/getMP')}", //发送请求地址
                            data:{ //发送给数据库的数据
                                action:"P"
                            },
                            //请求成功后的回调函数有两个参数
                            success:function(data,){
                                alert(data);
                            },
                            error:function () {

                            }
                        });
                    });


                    $("#createM").click(function () {
                        //获取M的值
                        $.ajax({
                            type:"post", //请求方式
                            url:"{:url('index/Blueprint/getMP')}", //发送请求地址
                            data:{ //发送给数据库的数据
                                action:"M"
                            },
                            //请求成功后的回调函数有两个参数
                            success:function(data,){
                                alert(data);
                            },
                            error:function () {

                            }
                        });

                    });
                });
            </script>

        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">外图编号</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value="{$detailArray.drawing_external_id}"  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">图纸名称</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">材料类型</label>
            <div class="layui-input-block">
                <div class="layui-input-inline">
                    <select name="modules" lay-verify="required" lay-search="" id="findText">
                        <option value="">请输入关键字...</option>
                        {volist name="$detailArray.material" id="materialList"}
                        <option value="{$materialList.material_id}">{$materialList.material_id}</option>
                        {/volist}
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">热处理类型</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">图纸类型</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">客户类型</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        
        <div class="layui-form-item">
            <label class="layui-form-label">是否批量</label>
            <div class="layui-input-block">
                <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="是|否"  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">材料形状</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">厚度</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">长度尺寸</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">宽度尺寸</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">保证厚度</label>
            <div class="layui-input-block">
                <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="是|否"  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">保证长度</label>
            <div class="layui-input-block">
                <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="是|否"  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">保证宽度</label>
            <div class="layui-input-block">
                <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="是|否"  >
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">排料数量</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">材料要求</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品加工费</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品报价</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品实价</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">创建人</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">最后修改人</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value=" "  >
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea"  >   </textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                增加
            </button>
        </div>
    </form>
</div>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;


        //监听提交
        form.on('submit(add)', function(data){
            console.log(data);
            //发异步，把数据提交给php
            layer.alert("增加成功", {icon: 6},function () {
                // 获得frame索引
                var index = parent.layer.getFrameIndex(window.name);
                //关闭当前frame
                parent.layer.close(index);
            });
            return false;
        });


    });
</script>
</body>

</html>